package com.edu.method;

public class MethodPractice04 {
    public static void main(String[] args) {
        //将一个已知数组赋值给另一个新数组
        int[] a={11,22,12,13,14,99,100};
        int[] b=new int[a.length];
        copy(a,b);
        arrayPrint(a);
        arrayPrint(b);
    }
    //输出数组
    public static void arrayPrint(int[] a){
        System.out.print("[");
        for (int i = 0; i < a.length; i++) {
            if(i!=a.length-1)
            System.out.print(a[i]+",");
            else
                System.out.print(a[i]);
        }
        System.out.println("]");
    }
    //复制数组
    public static void copy(int[] a,int[] b){
        for (int i = 0; i < a.length; i++) {
            b[i]=a[i];
        }
    }
}
